$(function () {
    //获取用户列表
    $.ajax({
        type: "get",
        url: "/user/queryUser",
        data: {
            page: 1,
            pageSize: 10
        },
        success: function (res) {
            console.log(res);
            $('.userInfo').html(template('userTemp', res))
        }
    });
    //更新用户状态
    $('.userInfo').on('click', '#editBtn', function () {
        var isDelete = Number($(this).attr('data-isDelete'))
        console.log(isDelete);

        $.ajax({
            type: "post",
            url: "/user/updateUser",
            data: {
                id: $(this).attr('data-id'),
                isDelete: isDelete ? 0 : 1
            },
            success: function (res) {
                console.log(res);
                if (res.success) {
                    location.reload()
                }
            }
        });

    })
})